

#include <cstdint>
#include <string>
#include <iostream>
#include <map>
#include <sstream>

#include <tenacitas.id.concept/id.h>

#include "runtest.h"

namespace tenacitas {
/** ==> namespace for the project */
    namespace id {
/** ==> application, bussiness, display, interaction, process, storage,
    transmittion */
        namespace concept {

            class id_tester {
                typedef t_id<uint16_t, id_tester> id;
                
            private:
                static bool test1() {
                    id l_id (234);

                    std::cout << "l_id = " << l_id << std::endl;

                    return (l_id == 234);
                }


                static bool test2() {
                    id l_id (234);

                    typedef std::map<id::value_t, std::string> map_t;
                    map_t l_map;

                    l_map.insert(std::make_pair<id::value_t,
                                 std::string>(234, "test 234"));

                    map_t::iterator l_ite = l_map.find(l_id.value());

                    if (l_ite != l_map.end()) {
                        std::cout << "(first, second) = ("
                                  << l_ite->first << "," << l_ite->second
                                  << ")" << std::endl;
                        return true;
                    }
                    
                    return false;
                }

                static bool test3() {
                    id l_id (433);

                    typedef std::map<id::value_t, std::string> map_t;
                    map_t l_map;

                    l_map.insert(std::make_pair<id::value_t,
                                 std::string>(l_id.value(), "test 433"));

                    map_t::iterator l_ite = l_map.find(l_id.value());

                    if (l_ite != l_map.end()) {
                        std::cout << "(first, second) = ("
                                  << l_ite->first << "," << l_ite->second
                                  << ")" << std::endl;
                        return true;
                    }
                    
                    return false;
                }

                static bool test4() {
                    id l_id (567);

                    typedef std::map<id::value_t, std::string> map_t;
                    map_t l_map;

                    l_map.insert(std::make_pair<id::value_t,
                                 std::string>(993, "test 993"));

                    map_t::iterator l_ite = l_map.find(l_id.value());

                    if (l_ite == l_map.end()) {
                        return true;
                    }
                    
                    return false;
                }

                static bool test5() {
                    id::value_t l_value(501);
                    
                    id l_id (std::move(l_value));

                    return (l_id == 501);
                }

                static bool test6() {
                    id::value_t l_value(501);
                    
                    id l_id (std::move(l_value));

                    return (l_id == l_value);
                }

                static bool test7() {
                    id l_1 (88);

                    id l_2 (l_1);

                    return (l_1.value() == l_2.value());
                }

                static bool test8() {
                    id l_1 (88);

                    id l_2 (std::move(l_1));

                    return (l_2.value() == 88);
                }

                static bool test9() {
                    id l_1 (88);

                    id l_2 (88);

                    return (l_1 == l_2);
                }

                static bool test10() {
                    id l_1 (88);

                    id l_2 (92);

                    return (l_1 != l_2);
                }

                static bool test11() {
                    id l_1 (88);

                    id l_2 (92);

                    return (l_1 <= l_2);
                }

                static bool test12() {
                    id l_1 (88);

                    id l_2 (92);

                    return (l_1 < l_2);
                }

                static bool test13() {
                    id l_1 (88);

                    id l_2 (92);

                    return (l_2 >= l_1);
                }
                
                static bool test14() {
                    id l_1 (88);

                    id l_2 (92);

                    return (l_2 > l_1);
                }

                static bool test15() {
                    id l_1 (92);

                    id l_2 (92);

                    return (l_1 >= l_2);
                }

                static bool test16() {
                    id l_1 (92);

                    id l_2 (92);

                    return (l_2 >= l_1);
                }

                static bool test17() {
                    id l_1 (92);

                    id l_2 = l_1;

                    return (l_2 == l_1);
                }
                
                static bool test18() {
                    id l_1 (92);

                    id::value_t l_value = l_1.value();
                    
                    id l_2 = std::move(l_1);

                    return (l_2 == l_value);
                }
                
                static bool test19() {
                    id::value_t l_value = 772;
                    
                    id l_2 = std::move(l_value);

                    return (l_2 == 772);
                }

                static bool test20() {
                    id::value_t l_value = 772;
                    
                    id l_2 = l_value;

                    return (l_2 == l_value);
                }

                static bool test21() {
                    std::string l_value ("772");
                    
                    id l_1(l_value);

                    return (l_1 == 772);
                }

                static bool test22() {
                    std::string l_value ("772");
                    
                    id l_1(std::move(l_value));

                    return (l_1 == 772);
                }

                static bool test23() {
                    const std::string l_value ("772");
                    
                    id l_1(l_value);

                    return (l_1 == 772);
                }
                
                static bool test24() {
                    const char * l_value ("772");
                    
                    id l_1(l_value);

                    return (l_1 == 772);
                }

                static bool test25() {
                    std::string l_value ("772");
                    
                    id l_1 = l_value;

                    return (l_1 == 772);
                }

                static bool test26() {
                    std::string l_value ("772");
                    
                    id l_1 = std::move(l_value);

                    return (l_1 == 772);
                }

                static bool test27() {
                    const std::string l_value ("772");
                    
                    id l_1 = l_value;

                    return (l_1 == 772);
                }
                
                static bool test28() {
                    const char * l_value ("772");
                    
                    id l_1 = l_value;

                    return (l_1 == 772);
                }

                static bool test29() {
                    
                    id l_1 = "772";

                    return (l_1 == 772);
                }

                static bool test30() {

                    std::stringstream l_stream;

                    l_stream << "772";

                    id l_id (88);

                    l_stream >> l_id;
                    
                    return (l_id == 772);
                }
            public:
                static void run() {
                    runtest(id_tester::test1());
                    runtest(id_tester::test2());
                    runtest(id_tester::test3());
                    runtest(id_tester::test4());
                    runtest(id_tester::test5());
                    runtest(id_tester::test6());
                    runtest(id_tester::test7());
                    runtest(id_tester::test8());
                    runtest(id_tester::test9());
                    runtest(id_tester::test10());
                    runtest(id_tester::test11());
                    runtest(id_tester::test12());
                    runtest(id_tester::test13());
                    runtest(id_tester::test14());
                    runtest(id_tester::test15());
                    runtest(id_tester::test16());
                    runtest(id_tester::test17());
                    runtest(id_tester::test18());
                    runtest(id_tester::test19());
                    runtest(id_tester::test20());
                    runtest(id_tester::test21());
                    runtest(id_tester::test22());
                    runtest(id_tester::test23());
                    runtest(id_tester::test24());
                    runtest(id_tester::test25());
                    runtest(id_tester::test26());
                    runtest(id_tester::test27());
                    runtest(id_tester::test28());
                    runtest(id_tester::test29());
                    runtest(id_tester::test30());
                }

            };
            

        }
    }
}


